package com.ostrich.cloud.ostrichManagerWeb.app.controller;

import com.ostrich.cloud.common.result.PageResult;
import com.ostrich.cloud.common.result.Result;
import com.ostrich.cloud.ostrichGoodsSercice.model.Dto.SalesDto;
import com.ostrich.cloud.ostrichGoodsSercice.model.param.GetSalesParam;
import com.ostrich.cloud.ostrichGoodsService.client.SalesClient;
import com.ostrich.cloud.ostrichManagerWeb.client.SalesManagerClient;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Date;

@RestController
public class SalesManagerApiImp implements SalesManagerClient {
    @Resource
    private SalesClient salesClient;

    @Override
    public Result getSalesOnly(Integer current, Integer size,Integer businessId, Date startTime, Date endTime) {

        GetSalesParam param=new GetSalesParam();
        param.setEndTime(endTime);
        param.setStartTime(startTime);
        param.setSize(size);
        param.setCurrent(current);
        param.setBusinessmanId(businessId);
        PageResult<SalesDto> salesDtoPageResult = salesClient.conditionsQuerySales(param);
        return salesDtoPageResult;

    }

    @Override
    public Result getAllSales(Integer current, Integer size) {
        PageResult<SalesDto> salesDto = salesClient.getAllSalesDto(current, size);
        return salesDto;
    }
}
